package com.zr.controller.driverclient;


import com.zr.service.driverclient.MsgService;
import com.zr.utils.AjaxResult;
import com.zr.vo.car.CarInfo;
import com.zr.vo.dispatch.DispatchMaintenance;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/msg")
@CrossOrigin
public class MsgController {

    @Resource
    private MsgService msgService;

    /**
     * 获取异常消息
     *
     * @param carInfo
     * @return
     */
    @PostMapping("/getAbnList")
    public AjaxResult getAbnList(@RequestBody CarInfo carInfo) {
        String carNumber = carInfo.getNumber();
        return AjaxResult.success(200, "查询成功", msgService.getAbnList(carNumber));
    }

    /**
     * 获取维保消息
     *
     * @param carInfo
     * @return
     */
    @PostMapping("/getMtList")
    public AjaxResult getMtList(@RequestBody CarInfo carInfo) {
        String carNumber = carInfo.getNumber();
        return AjaxResult.success(200, "查询成功", msgService.getMtList(carNumber));
    }

    /**
     * 更新维保状态
     *
     * @param
     * @return
     */
    @PostMapping("/editMtStatus")
    public AjaxResult editMtStatus(@RequestBody DispatchMaintenance dispatchMaintenance) {
        return AjaxResult.success(200, "查询成功", msgService.editMtStatus(dispatchMaintenance));
    }

}
